﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page
{
    static int Score = 0;
    static int checker = 3;
    static String Answer = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        Label3.Text = Score.ToString();
       if(!IsPostBack)
        PicLoad();
        //Image1.ImageUrl = "~/Images/Kellogs.JPG";
    }
    public void PicLoad()
    {
        Random Number1 = new Random();
        int a = Number1.Next(1, 10);
        
        String Path = "~/Images/";
        String Path1 = "~/Images/";
        switch (a)
        {
            case 1:
                {
                    Path = Path + "BMW.gif";
                    Path1 = Path1 + "BMWLogo.JPG";
                    Answer = "BMW";
                } break;
            case 2:
                {
                    Path = Path + "fb.png";
                    Path1 = Path1 + "fbLogo.JPG";
                    Answer = "facebook";
                } break;
            case 3:
                {
                    Path = Path + "Kellogs.JPG";
                    Path1 = Path1 + "KellogsLogo.JPG";
                    Answer = "kellogs";
                } break;
            case 4:
                {
                    Path = Path + "Nike.JPG";
                    Path1 = Path1 + "NikeLogo.gif";
                    Answer = "nike";
                } break;
            case 5:
                {
                    Path = Path + "PizzaHut.png";
                    Path1 = Path1 + "PizzaHutLogo.png";
                    Answer = "pizza hut";
                } break;
            case 6:
                {
                    Path = Path + "Pringles.JPG";
                    Path1 = Path1 + "PringlesLogo.JPG";
                    Answer = "pringles";
                } break;
            case 7:
                {
                    Path = Path + "Reebok.JPG";
                    Path1 = Path1 + "ReebokLogo.JPG";
                    Answer = "reebok";
                } break;
            case 8:
                {
                    Path = Path + "Twitter.JPG";
                    Path1 = Path1 + "TwitterLogo.png";
                    Answer = "twitter";
                } break;
            case 9:
                {
                    Path = Path + "Volkswagen.JPG";
                    Path1 = Path1 + "VolkswagenLogo.JPG";
                    Answer = "volkswagen";
                } break;
        }
        Image1.ImageUrl = Path;
        Image2.ImageUrl = Path1;
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if(TextBox1.Text.ToUpper()==Answer.ToUpper())
        {
            Score += 10;
            Label3.Text = Score.ToString();
            Image2.Visible = true;
        }
        else
        {
            string script = "alert('Wrong Answer!')";
            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
        }
        TextBox1.Text = "";
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";
        Image2.Visible = false;
        PicLoad();
    }
}